package com.hnevc.mytrafficdemo.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.hnevc.mytrafficdemo.R;
import com.hnevc.mytrafficdemo.entity.BusStatus;

import java.util.List;

/**
 * Created by Administrator on 2017/12/24.
 */

public class MyBusCapacityAdapter extends BaseAdapter{
    List<BusStatus> mBusList;
    Context mContext;

    public MyBusCapacityAdapter(List<BusStatus> busList, Context context) {
        mBusList = busList;
        mContext = context;
    }

    @Override
    public int getCount() {
        return mBusList.size();
    }

    @Override
    public Object getItem(int i) {
        return mBusList.get(i);
    }

    @Override
    public long getItemId(int i) {
        return mBusList.get(i).getBusId();
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        view = LayoutInflater.from(mContext).inflate(R.layout.bus_capacity_list_item,null);
        TextView mTvId = (TextView) view.findViewById(R.id.id_tv_id);
        mTvId.setText(i+"");

        TextView mTvBusId = (TextView) view.findViewById(R.id.id_tv_bus_id);
        mTvBusId.setText(mBusList.get(i).getBusId()+"");

        TextView mTvBusCapacity = (TextView) view.findViewById(R.id.id_tv_bus_capacity);
        mTvBusCapacity.setText(mBusList.get(i).getCapacity()+"");

        return view;
    }
}
